// This kernel fetches data from global memory to kernel and 
// then directly stores them back to global memory
// Different accessing patterns are compared to the influences on bandwidth
// 2015.06.17 by wangdong@bjtu.edu.cn
#include "ap_int.h"

typedef unsigned int  uint;

#define VEC_SIZE   16

// coding style 1
typedef ap_uint<VEC_SIZE*32> float_vec;
 // coding style 2
//typedef struct {
//   float data[VEC_SIZE];
//} float_vec;

extern "C" {
void memAccess(
                float_vec *A_in,
                float_vec *B_out,
                uint data_num
                )
{
#pragma HLS INTERFACE m_axi port = A_in  offset = slave bundle = gmem // group-0
#pragma HLS INTERFACE m_axi port = B_out  offset = slave bundle = gmem // group-0
// The following pragma are used for vivado IP flow only
//#pragma HLS INTERFACE s_axilite port = A_in  bundle = control
//#pragma HLS INTERFACE s_axilite port = B_out  bundle = control
//#pragma HLS INTERFACE s_axilite port = data_num  bundle = control
//#pragma HLS INTERFACE ap_ctrl_hs port = return

	float_vec tmp;

	for(uint i=0; i<data_num; i++){
		tmp = A_in[i];
		B_out[i] = tmp;
	}

}
}
